package com.wwwzh.himalayafm.fragment.disfragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

import com.wwwzh.himalayafm.R;
import com.wwwzh.himalayafm.activity.XmlyActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class CategorySerachFragment extends Fragment implements View.OnClickListener {

    private XmlyActivity activity;
    private EditText mEditText;
    private Button mButton;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activity = (XmlyActivity) getActivity();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_category_serach, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        Toolbar mToolbar = (Toolbar) view.findViewById(R.id.tb_category_search_id);
        activity.setSupportActionBar(mToolbar);
        ActionBar actionBar = activity.getSupportActionBar();
        actionBar.setDisplayShowTitleEnabled(false);
        mEditText = (EditText) mToolbar.findViewById(R.id.et_category_search_id);
        mButton = (Button) mToolbar.findViewById(R.id.bt_category_search_id);
        mButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        activity.getDrawerLayout().closeDrawer(Gravity.RIGHT);
    }
}
